package com.usian.wemedia.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.usian.model.admin.dtos.NewsAuthDto;
import com.usian.model.media.dtos.WmNewsResultDTO;
import com.usian.wemedia.entity.WmNews;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 自媒体图文内容信息表 Mapper 接口
 * </p>
 *
 * @author usian
 * @since 2022-10-04
 */
public interface WmNewsMapper extends BaseMapper<WmNews> {
    @Select("<script>SELECT a.*,b.name authorName FROM wm_news a INNER JOIN wm_user b ON a.`wm_user_id`=b.`id` " +
            "<where> " +
            "<if test=\"dto.title!=null and dto.title!=''\">" +
            "a.`title` LIKE concat('%',#{dto.title},'%')" +
            "</if>" +
            "</where></script>")
    IPage<WmNewsResultDTO> slectWmNewsByPage(Page<WmNews> page, NewsAuthDto dto);
}
